package com.vcredit.creditcat.vo;

import java.io.Serializable;

public class JsonResult<T> implements Serializable {

	private static final long serialVersionUID = 1L;
	private String status;
	private String message;
	private T data;

	public JsonResult(String status, String message, T data) {
		super();
		this.status = status;
		this.data = data;
		this.message = message;
	}

	public JsonResult(T data) {
		super();
		this.status = "000";
		this.data = data;
		this.message = "请求数据成功";
	}
	
	public JsonResult(){}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public static <T> JsonResult<T> SuccessResponse(T data) {
		return new JsonResult<T>("000", "请求数据成功", data);
	}

	public static <T> JsonResult<T> ErrorResponse(String errorMessage) {
		return new JsonResult<T>("001", errorMessage, null);
	}

	public static <T> JsonResult<T> ErrorResponse(String status, String errorMessage) {
		return new JsonResult<T>(status, errorMessage, null);
	}
}
